<?php
declare (strict_types = 1);

namespace app\validate\api;

use think\Validate;

/**
 * 原神抽卡分析验证器
 * Class Index
 * @package app\index\validate
 */
class Genshin extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'url'                  => 'require',
        'uid'                  => 'require',
        'page'                 => 'number',
        'avatar_id'            => 'require|number',
        'team_id'              => 'require|number',
        'avatar_level_current' => 'require|number|between:1,90',
        'avatar_level_target'  => 'require|number|between:1,90',
        'skill_list'           => 'require',
        'openid'               => 'require'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'url.require'                    => '请输入正确的url地址',
        'uid.require'                    => 'uid不可为空',
        'page.number'                    => 'page必须为数字',
        'team_id.number'                 => 'team_id必须为数字',
        'avatar_id.number'               => 'avatar_id必须为数字',
        'avatar_level_current.number'    => 'avatar_level_current必须为数字',
        'avatar_level_current.between'   => 'avatar_level_current必须在1~90之间',
        'avatar_level_target.number'     => 'avatar_level_target必须为数字',
        'avatar_level_target.between'    => 'avatar_level_target必须在1~90之间',
    ];


    protected $scene = [
        'add'      =>  ['url'],
        'history'  =>  ['uid'],
        'info'  =>  ['avatar_id'],
        'level' =>  ['avatar_id','avatar_level_current','avatar_level_target','skill_list'],
        'team'  =>  ['page'],
        'team_detail'   =>  ['team_id'],
        'collect'       =>  ['team_id','openid'],
        'like'       =>  ['team_id','openid'],
        'collect_list'  =>  ['openid'],
    ];

}
